package com.su.ou.yang;

public class Test11 {
    public static void main(String[] args) {
       int [] num={ 1,2,3,4,5,6,7} ;
      int k = 3;
        int[] ints = solve(num, 3);
        for (int i = 0; i < ints.length; i++) {
            System.out.println(ints[i]);
        }
    }
    public  static int[] solve(int[] num,int k){
        int len=num.length;
        k=k%len;
        reverse(num,0,len-1);
        reverse(num,0,k-1);
        reverse(num,k,len-1);
        return  num;

    }

    private  static void reverse(int[] num, int i, int j) {
        while(i<j){
            int temp=num[i];
            num[i]=num[j];
            num[j]=temp;
            i++;
            j--;
        }
    }
}
